package com.own.business.wallet.controller.user.form;

import com.own.component.common.exception.BusinessSimpleException;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * WalletPayResponseForm
 *
 * @author chenxueli
 * @date 2023-08-28 16:28:51
 */
@Data
public class WalletPayForm implements Serializable {

    @Schema(title = "订单号")
    private String tradeNo;

    @Schema(title = "加密key")
    private String key;

    @Schema(title = "支付密码")
    private String password;

    @Schema(title = "支付令牌")
    private String payToken;

    public void check() {
        if (StringUtils.isBlank(tradeNo)) {
            throw new BusinessSimpleException("订单号不能为空");
        }
        if (StringUtils.isBlank(key)) {
            throw new BusinessSimpleException("加密key不能为空");
        }
        if (StringUtils.isBlank(payToken) && StringUtils.isBlank(password)) {
            throw new BusinessSimpleException("支付密码不能为空");
        }
    }

}
